package view.admin;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;

public class AdminDialog extends JDialog{
	
	JTabbedPane tabView;
	JButton btFinish = new JButton("Hoàn tất");
	JButton btCancel = new JButton("Hủy bỏ");
	
	public AdminDialog(JFrame parent){
		super(parent, "Administrator", true);
		setSize(1000, 500);
		setLocationRelativeTo(parent);
		
		initUI();
	}
	
	public void initUI(){
		tabView = new JTabbedPane(JTabbedPane.TOP);
		
		tabView.addTab("Quản lí phòng", new ManageRoom());
		tabView.addTab("Quản lí dịch vụ", null);
		tabView.addTab("Quản lí người dùng", null);
		tabView.addTab("button1", null);
		tabView.addTab("button2", null);		
		tabView.setTabComponentAt(3, btFinish);
		tabView.setTabComponentAt(4, btCancel);		
		ButtonHandler handler = new ButtonHandler();
		btFinish.addActionListener(handler);
		btCancel.addActionListener(handler);		
		add(tabView);
	}
	
	class ButtonHandler implements ActionListener{
		public void actionPerformed(ActionEvent event){
			if (event.getSource() == btFinish){
				dispose();
			}else if (event.getSource() == btCancel){
				dispose();
			}
		}
	}
}
